package br.com.cadele.beans;

import java.io.Serializable;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import br.com.cadele.model.Turma;
import br.com.cadele.service.TurmaService;

import com.ocpsoft.pretty.faces.annotation.URLBeanName;
import com.ocpsoft.pretty.faces.annotation.URLMapping;

@ManagedBean(name="cadastrarTurmaBean")
@ViewScoped
@URLBeanName(value="cadastrarTurmaBean")
@URLMapping(id="cadastrarTurmaBean", pattern="/turma/cadastrar", viewId="/pages/turma/cadastrar.xhtml")
public class CadastrarTurmaBean implements Serializable{

	private static final long serialVersionUID = 8708639949833858883L;
	private Turma turma;
	private TurmaService turmaService;

	@PostConstruct
	public void init(){
		turma = new Turma();
		turmaService = new TurmaService();
	}
	
	public void salvar() {
		turmaService.executeInsert(turma);
	}
	
	public Turma getTurma() {
		return turma;
	}
	
	public void setTurma(Turma turma) {
		this.turma = turma;
	}
}
